{"ast":null,"code":"import _defineProperty from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport merge from '../merge';\nimport { styleFunctionMapping as defaultStyleFunctionMapping } from '../getThemeValue';\nimport { handleBreakpoints, createEmptyBreakpointObject, removeUnusedBreakpoints } from '../breakpoints';\nfunction objectsHaveSameKeys() {\n  for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {\n    objects[_key] = arguments[_key];\n  }\n  var allKeys = objects.reduce(function (keys, object) {\n    return keys.concat(Object.keys(object));\n  }, []);\n  var union = new Set(allKeys);\n  return objects.every(function (object) {\n    return union.size === Object.keys(object).length;\n  });\n}\nfunction callIfFn(maybeFn, arg) {\n  return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function unstable_createStyleFunctionSx() {\n  var styleFunctionMapping = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultStyleFunctionMapping;\n  var propToStyleFunction = Object.keys(styleFunctionMapping).reduce(function (acc, styleFnName) {\n    styleFunctionMapping[styleFnName].filterProps.forEach(function (propName) {\n      acc[propName] = styleFunctionMapping[styleFnName];\n    });\n    return acc;\n  }, {});\n  function getThemeValue(prop, value, theme) {\n    var _inputProps;\n    var inputProps = (_inputProps = {}, _defineProperty(_inputProps, prop, value), _defineProperty(_inputProps, \"theme\", theme), _inputProps);\n    var styleFunction = propToStyleFunction[prop];\n    return styleFunction ? styleFunction(inputProps) : _defineProperty({}, prop, value);\n  }\n  function styleFunctionSx(props) {\n    var _ref2 = props || {},\n      sx = _ref2.sx,\n      _ref2$theme = _ref2.theme,\n      theme = _ref2$theme === void 0 ? {} : _ref2$theme;\n    if (!sx) {\n      return null; // Emotion & styled-components will neglect null\n    }\n\n    /*\n     * Receive `sxInput` as object or callback\n     * and then recursively check keys & values to create media query object styles.\n     * (the result will be used in `styled`)\n     */\n    function traverse(sxInput) {\n      var sxObject = sxInput;\n      if (typeof sxInput === 'function') {\n        sxObject = sxInput(theme);\n      } else if (typeof sxInput !== 'object') {\n        // value\n        return sxInput;\n      }\n      if (!sxObject) {\n        return null;\n      }\n      var emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);\n      var breakpointsKeys = Object.keys(emptyBreakpoints);\n      var css = emptyBreakpoints;\n      Object.keys(sxObject).forEach(function (styleKey) {\n        var value = callIfFn(sxObject[styleKey], theme);\n        if (value !== null && value !== undefined) {\n          if (typeof value === 'object') {\n            if (propToStyleFunction[styleKey]) {\n              css = merge(css, getThemeValue(styleKey, value, theme));\n            } else {\n              var breakpointsValues = handleBreakpoints({\n                theme: theme\n              }, value, function (x) {\n                return _defineProperty({}, styleKey, x);\n              });\n              if (objectsHaveSameKeys(breakpointsValues, value)) {\n                css[styleKey] = styleFunctionSx({\n                  sx: value,\n                  theme: theme\n                });\n              } else {\n                css = merge(css, breakpointsValues);\n              }\n            }\n          } else {\n            css = merge(css, getThemeValue(styleKey, value, theme));\n          }\n        }\n      });\n      return removeUnusedBreakpoints(breakpointsKeys, css);\n    }\n    return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);\n  }\n  return styleFunctionSx;\n}\nvar styleFunctionSx = unstable_createStyleFunctionSx();\nstyleFunctionSx.filterProps = ['sx'];\nexport default styleFunctionSx;","map":{"version":3,"names":["merge","styleFunctionMapping","defaultStyleFunctionMapping","handleBreakpoints","createEmptyBreakpointObject","removeUnusedBreakpoints","objectsHaveSameKeys","objects","allKeys","reduce","keys","object","concat","Object","union","Set","every","size","length","callIfFn","maybeFn","arg","unstable_createStyleFunctionSx","propToStyleFunction","acc","styleFnName","filterProps","forEach","propName","getThemeValue","prop","value","theme","inputProps","styleFunction","styleFunctionSx","props","sx","traverse","sxInput","sxObject","emptyBreakpoints","breakpoints","breakpointsKeys","css","styleKey","undefined","breakpointsValues","x","Array","isArray","map"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js"],"sourcesContent":["import merge from '../merge';\nimport { styleFunctionMapping as defaultStyleFunctionMapping } from '../getThemeValue';\nimport { handleBreakpoints, createEmptyBreakpointObject, removeUnusedBreakpoints } from '../breakpoints';\nfunction objectsHaveSameKeys(...objects) {\n  const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []);\n  const union = new Set(allKeys);\n  return objects.every(object => union.size === Object.keys(object).length);\n}\nfunction callIfFn(maybeFn, arg) {\n  return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function unstable_createStyleFunctionSx(styleFunctionMapping = defaultStyleFunctionMapping) {\n  const propToStyleFunction = Object.keys(styleFunctionMapping).reduce((acc, styleFnName) => {\n    styleFunctionMapping[styleFnName].filterProps.forEach(propName => {\n      acc[propName] = styleFunctionMapping[styleFnName];\n    });\n    return acc;\n  }, {});\n  function getThemeValue(prop, value, theme) {\n    const inputProps = {\n      [prop]: value,\n      theme\n    };\n    const styleFunction = propToStyleFunction[prop];\n    return styleFunction ? styleFunction(inputProps) : {\n      [prop]: value\n    };\n  }\n  function styleFunctionSx(props) {\n    const {\n      sx,\n      theme = {}\n    } = props || {};\n    if (!sx) {\n      return null; // Emotion & styled-components will neglect null\n    }\n\n    /*\n     * Receive `sxInput` as object or callback\n     * and then recursively check keys & values to create media query object styles.\n     * (the result will be used in `styled`)\n     */\n    function traverse(sxInput) {\n      let sxObject = sxInput;\n      if (typeof sxInput === 'function') {\n        sxObject = sxInput(theme);\n      } else if (typeof sxInput !== 'object') {\n        // value\n        return sxInput;\n      }\n      if (!sxObject) {\n        return null;\n      }\n      const emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);\n      const breakpointsKeys = Object.keys(emptyBreakpoints);\n      let css = emptyBreakpoints;\n      Object.keys(sxObject).forEach(styleKey => {\n        const value = callIfFn(sxObject[styleKey], theme);\n        if (value !== null && value !== undefined) {\n          if (typeof value === 'object') {\n            if (propToStyleFunction[styleKey]) {\n              css = merge(css, getThemeValue(styleKey, value, theme));\n            } else {\n              const breakpointsValues = handleBreakpoints({\n                theme\n              }, value, x => ({\n                [styleKey]: x\n              }));\n              if (objectsHaveSameKeys(breakpointsValues, value)) {\n                css[styleKey] = styleFunctionSx({\n                  sx: value,\n                  theme\n                });\n              } else {\n                css = merge(css, breakpointsValues);\n              }\n            }\n          } else {\n            css = merge(css, getThemeValue(styleKey, value, theme));\n          }\n        }\n      });\n      return removeUnusedBreakpoints(breakpointsKeys, css);\n    }\n    return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);\n  }\n  return styleFunctionSx;\n}\nconst styleFunctionSx = unstable_createStyleFunctionSx();\nstyleFunctionSx.filterProps = ['sx'];\nexport default styleFunctionSx;"],"mappings":";AAAA,OAAOA,KAAK,MAAM,UAAU;AAC5B,SAASC,oBAAoB,IAAIC,2BAA2B,QAAQ,kBAAkB;AACtF,SAASC,iBAAiB,EAAEC,2BAA2B,EAAEC,uBAAuB,QAAQ,gBAAgB;AACxG,SAASC,mBAAmB,GAAa;EAAA,kCAATC,OAAO;IAAPA,OAAO;EAAA;EACrC,IAAMC,OAAO,GAAGD,OAAO,CAACE,MAAM,CAAC,UAACC,IAAI,EAAEC,MAAM;IAAA,OAAKD,IAAI,CAACE,MAAM,CAACC,MAAM,CAACH,IAAI,CAACC,MAAM,CAAC,CAAC;EAAA,GAAE,EAAE,CAAC;EACtF,IAAMG,KAAK,GAAG,IAAIC,GAAG,CAACP,OAAO,CAAC;EAC9B,OAAOD,OAAO,CAACS,KAAK,CAAC,UAAAL,MAAM;IAAA,OAAIG,KAAK,CAACG,IAAI,KAAKJ,MAAM,CAACH,IAAI,CAACC,MAAM,CAAC,CAACO,MAAM;EAAA,EAAC;AAC3E;AACA,SAASC,QAAQ,CAACC,OAAO,EAAEC,GAAG,EAAE;EAC9B,OAAO,OAAOD,OAAO,KAAK,UAAU,GAAGA,OAAO,CAACC,GAAG,CAAC,GAAGD,OA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